package dao.concret;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import dao.AbstractTable;
import dao.DAO;
import dao.tables.OEUVRE;

public class OeuvreDAO extends DAO<OEUVRE> {

    @Override
    public OEUVRE find(long id) {
	OEUVRE oeuvre = new OEUVRE();
	try {
	    Statement stmt = this.connect.createStatement(
		    ResultSet.TYPE_SCROLL_INSENSITIVE,
		    ResultSet.CONCUR_UPDATABLE);
	    ResultSet result = stmt
		    .executeQuery("SELECT * FROM redline.OEUVRE WHERE IDOEUVRE = "
			    + id);
	    if (result.first()) {
		oeuvre.setId(id);
		oeuvre.setTitre(result.getString("TITREOEUVRE"));
	    }
	    result.close();
	    stmt.close();
	} catch (SQLException sqle) {
	    sqle.printStackTrace();
	}
	return oeuvre;
    }

    @Override
    public OEUVRE create(AbstractTable at) {
	OEUVRE obj = (OEUVRE) at;
	obj.getClass();
	return null;
    }

    @Override
    public OEUVRE update(AbstractTable at) {
	OEUVRE obj = (OEUVRE) at;
	obj.getClass();
	return null;
    }

    @Override
    public OEUVRE delete(OEUVRE at) {
	OEUVRE obj = (OEUVRE) at;
	obj.getClass();
	return null;
    }

    @Override
    public OEUVRE[] list() {
	return null;
    }

}
